Nginx配置自定义的403页面 |
您所在的位置:网站首页 › nginx 跳转维护页面 › Nginx配置自定义的403页面 |
1.开启nginx的状态码,虚拟主机配置中加入下边一段 location /nginx_status{ stub_status on; access_log off; }或着在nginx的http模块加入:fastcgi_intercept_errors on; 2.在server模块加入 根据需求来配置,因为deny语句把所有对403.html的访问给deny了,所以需要在locaction = /403.html里面加上allow all,让所有的IP地址能访问403.html具体过程如下 需求A:允许某个拒绝所有 location / { allow 192.168.1.0/24; deny all; error_page 403 /403.html; location /403.html { allow all; }}需求B:拒绝某个允许所有 location / { deny 192.168.1.0/24; alllow all; error_page 403 /403.html; location /403.html { allow all; }}3.编写403页面,并放入html下面 403 Forbidden403 ForbiddenYou don't have permission to access the URL on this server. Sorry for the inconvenience.This is a our test website, please visit our official website www.localhost.comThank you very much! URL: http://www.localhost.comDate:var enabled = 0; today = new Date();var date;M=today.getMonth() + 1D=today.getDate()HH=today.getHours()MM=today.getMinutes()SS=today.getSeconds()if (M |
今日新闻 |
推荐新闻 |
CopyRight 2018-2019 办公设备维修网 版权所有 豫ICP备15022753号-3 |